<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="css/zhuce.css">
    <style>
        #box .one-title .left {
            width: 50%;
            height: 100%;
            float: left;
            background: url(img/01ff_03.gif)no-repeat -27px 37px;

        }

        #box .one-title .right {
            width: 50%;
            height: 100%;
            float: left;
            background: url(img/01_03.gif)no-repeat -27px 37px;
        }
    </style>
</head>

<body>
    <div id="box">
        <div class="box-con">
            <div class="title">
                <span>Mercedes me Id</span>
            </div>
            <div class="one-title">
                <div class="left">
                    <span>
                        <a href="submit.html">登录</a>
                    </span>
                </div>
                <div class="right">
                    <span>
                        <a href="">注册</a>
                    </span>
                </div>
            </div>
            <div class="two-title">
                <div class="box1">
                    <input type="text" placeholder="账号" id="username">
                </div>
                <div class="box2">
                    <input type="text" placeholder="密码" id="password">
                </div>
                <div class="box3" id="btn">确定</div>
                <div class="box4">
                    创建您的Mercedes me ID
                </div>
                <div class="box5">
                    <div class="weixin"></div>
                    <div class="qq"></div>
                    <div class="weibo"></div>
                </div>

            </div>
        </div>
    </div>
    <script src="js/jquery.min.js"></script>
    <script>
        	$("#btn").click(function(){
			
				$.ajax({
					url:"http://127.0.0.1/bc/zhuce.php",
					method:"post",
					data:{
						username:$("#username").val(),
						password:$("#password").val()
					},
					success(data){
						if(data === "success"){
							alert("注册成功");
                            location.href="submit.html"
						}
						else{
							alert("注册失败")
						}
					}
				})
			})
        // $("#btn").click(function () {
        //     let http = new XMLHttpRequest()
        //     http.open("get", `http://127.0.0.1:8080/adduser?username=${$("#username").val()}&password=${$("#password").val()}`)
        //     http.send()
        //     http.onreadystatechange = function () {
        //         if (http.readyState === 4) {
        //             // if(http.responseText === "success"){
        //             //   alert("登录成功")
        //             //   location.href = "http://10.35.161.20/27.01/作业/oA.html"
        //             // }
        //             // else{
        //             // 	alert("用户名或密码错误")
        //             // }
        //             if (http.responseText === "error") {
        //                 alert("注册失败")
        //             }
        //             if (http.responseText === "success") {
        //                 //   sessionStorage.setItem("isLogin","1")
        //                 alert("注册成功");
        //                 localStorage.href = "http://1270.0.0.1/submit.html"
        //                 //    location.href = "https://www.mercedes-benz.com.cn/"
        //             }
        //         }
        //     }

        // })

    </script>
</body>

</html>